/*
 * worker.cpp
 *
 *  Created on: Mar 2, 2013
 *      Author: RDU
 */

#include "worker.h"

WorkerThread::WorkerThread(MyFrame *pFrame):wxThread(wxTHREAD_DETACHED)
{
	m_pFrame=pFrame;
	m_camera=NULL;
	m_bLife=false;
	m_pMutex=new wxMutex();
}

WorkerThread::~WorkerThread()
{
	m_pMutex=NULL;
	m_pFrame=NULL;
	m_camera=NULL;
}

void WorkerThread::OnExit()
{
	delete(m_pMutex);
}

void *WorkerThread::Entry()
{
	m_bLife=true;

	while(m_bLife)
	{
		if(TestDestroy()==1)
			break;

		//work to do
		m_camera->CamerasRun();

		wxThread::Sleep(5);
	}

	return NULL;
}
